using UnityEngine;

namespace NodeCanvas.Actions
{
	[Name("Set Visibility")]
	[Category("GameObject")]
	[AgentType(typeof(Transform))]
	public class SetObjectVisibility : ActionTask
	{
		public enum SetMode
		{
			Invisible = 0,
			Visible = 1,
			Toggle = 2
		}

		public SetMode SetTo = SetMode.Toggle;

		protected override string info
		{
			get
			{
				return string.Concat("Set Visibility To '", SetTo, "'");
			}
		}

		protected override void OnExecute()
		{
			bool active = ((SetTo != SetMode.Toggle) ? (SetTo == SetMode.Visible) : (!base.agent.gameObject.activeSelf));
			base.agent.gameObject.SetActive(active);
			EndAction();
		}
	}
}
